package cn.tedu.spring;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * Author：程Sir
 * Name： framework
 * Content:
 */
@Controller
@RequestMapping("/p")
public class PersonController {

    // http://localhost:8080/SpringMvcTest01/p/login.do?message=张三
    @RequestMapping("/login.do")
    @ResponseBody
    public String login(String message, HttpSession session ){
        //将出入的message存入session中
        session.setAttribute("message",message);
        return message+" login ok!";
    }
    // http://localhost:8080/SpringMvcTest01/p/delete.do
    @RequestMapping("/delete.do")
    @ResponseBody
    public String delete( ){
        System.out.println("执行删除动作...");
        return "delete ok!";
    }
}
